package com.zwb.game.data;

import com.google.inject.Injector;
import com.zwb.game.core.classloader.JarClassLoader;

/**
 * 程序启动类
 * Create by zwb on 2020-01-18 15:43
 */
public abstract class Main {

    /**
     * 创建一个{@link Main} 实例
     *
     * @return
     */
    public static Main createMain(String scriptPath) {
        JarClassLoader classLoader = new JarClassLoader(scriptPath);
        try {
            Class<?> clazz = classLoader.loadClass("com.zwb.game.ScriptMain");
            return (Main) clazz.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public abstract Injector jar();
}
